import request from '@/utils/request'

// 获取有商品数量的各级商品分类（分页）
export function pageCategoryWithGoods(data) {
  return request({
    url: '/goods/enterpriseGoodsCategory/pageCategoryWithGoods',
    method: 'get',
    params: data
  })
}

// 根据父级分类id获取企业商品分类（众项云企使用）
export function listCategoryByParentId(enterpriseId, parentCategoryId) {
  return request({
    url: '/goods/enterpriseGoodsCategory/listCategoryByParentId',
    method: 'get',
    params: { enterpriseId, parentCategoryId }
  })
}

// 获取企业商品类目
export function listEnterpriseGoodsCategory(data) {
  return request({
    url: '/goods/enterpriseGoodsCategory/listEnterpriseGoodsCategory',
    method: 'get',
    params: data
  })
}

// 获取第三方类目集合
export function listThirdCategory(enterpriseCategoryId) {
  return request({
    url: '/goods/thirdCategory/listThirdCategory',
    method: 'get',
    params: { enterpriseCategoryId }
  })
}

// 获取企业商品类目
export function getCategory(query) {
  return request({
    url: '/goods/enterpriseGoodsCategory/get',
    method: 'get',
    params: query
  })
}

// 保存企业商品类目
export function saveEnterpriseCategory(data) {
  return request({
    url: '/goods/enterpriseGoodsCategory/save',
    method: 'post',
    data: data
  })
}

// 保存企业商品类目
export function savePoster(data) {
  return request({
    url: '/goods/enterpriseGoodsCategory/savePoster',
    method: 'post',
    data: data
  })
}

// 删除企业商品类目
export function deleteEnterpriseCategory(enterpriseCategoryId) {
  return request({
    url: '/goods/enterpriseGoodsCategory/delete',
    method: 'post',
    params: {
      enterpriseCategoryId
    }
  })
}

// 获取分类自定义属性参数列表
export function pageGetPropertyList(query) {
  return request({
    url: '/goods/enterpriseGoodsCategory/pageGetPropertyList',
    method: 'post',
    params: query
  })
}

// 批量保存或更新分类自定义属性参数表
export function saveBatchProperty(data) {
  return request({
    url: '/goods/enterpriseGoodsCategory/saveBatchProperty',
    method: 'post',
    data: data
  })
}
